/*
*  SkyOpenALBuffer.h
*  
*
*  Created by Alexander Trutchenko on 11/02/12.
*  Copyright 2012 Free Team. All rights reserved.
*
*/

#ifndef __Sky_OpenALBuffer_h__
#define __Sky_OpenALBuffer_h__

#include "SkyBufferHeader.h"

#include "SkyOpenALInclude.h"
#include "SkyTypes.h"

#include <string>

namespace sky {

////////////////////////////////////////////////////////
//
/** SkyOpenALBuffer
*  
*/
////////////////////////////////////////////////////////

class SkyBufferManager;

class SkyOpenALBuffer : public SkyRefCounted
{
friend class SkyBufferManager;

private:
	SkyBufferHeader _header;
	ALuint _bufferID;
	bool _isOk;

private:
	explicit SkyOpenALBuffer(const SkyOpenALBuffer&);
	SkyOpenALBuffer& operator = (const SkyOpenALBuffer&);

protected:
	SkyOpenALBuffer(ALuint bufferID, const char* file);
	SkyOpenALBuffer();
	~SkyOpenALBuffer();

public:
	const SkyBufferHeader& header() const { return _header; }
	inline const ALuint& bufferID() const { return _bufferID; }
	inline bool isOk() const { return _isOk; }
	bool setData(const ALvoid* decodedData, const SkyBufferHeader& header);
}; // class SkyOpenALBuffer

} // namespace sky

#endif //__Sky_OpenALBuffer_h__
